#include<iostream>
using namespace std;
int main()
{
	int a[10] = { 0 };
	void input(int *);
	void output(int *);
	void max_min(int *);
	input(a);
	max_min(a);
	output(a);
	return 0;
}
void input(int* m)
{
	int* p;
	for (p = m; p < m + 10; p++)
		cin >> *p;
	//int i;
		/*cout << "input 10 number: ";
		for (i = 0; i < 10; i++)
		{
			cin >> m[i];
		}*/
}
void output(int* m)
{
	int* p;
	cout << "the last result is : ";
	for (p = m; p < m + 10; p++)
		cout << *p << " ";

}
void max_min(int* m)
{
	int* max = m, * min = m;
	int temp;
	for (int* p = m + 1; p < m + 10; p++)
	{
		if (*p > *max)
			max = p;
		else if (*p < *min)
			min = p;
	
	}
	temp = m[9];
	m[9] = *max;
	*max = temp;
	temp = m[0];
	m[0] = *min;
	*min = temp;
}